package org.ihelpuoo.orm.handler.rs;

import java.lang.reflect.Field;
import java.sql.Connection;
import java.util.List;

import org.ihelpuoo.db.ResultSetProxy;
import org.ihelpuoo.orm.ObjectRule;
import org.ihelpuoo.orm.filter.Filter;
import org.ihelpuoo.orm.filter.SegmentObjectFilter;
import org.ihelpuoo.orm.handler.ObjectProcessor;

public class ResultSetSequenceFieldUtils
{
	static List evalObjectList(ObjectProcessor processor, ObjectRule r, Field f, Object src,
			Filter filter, Object parent, Class subType) throws Exception
	{
		Connection conn = ((ResultSetProxy)src).getConnection();
		ObjectRule subBr = processor.getManual().getRule(subType);
		return processor.query(subBr,conn,subType,filter,null,null,null,null);
	}

	static Filter evalObjectFilter(ObjectRule r, Field f, Object parent)
	{
		SegmentObjectFilter filter = r.getDBFieldFilter(f);
		if (null != filter)
			filter.setObject(parent);
		return filter;
	}

}
